home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / ENTRPRIS / APE / AEWRKPVD / CLSWRKPD.CLS < prev   
Encoding:
Visual Basic class definition  |  1996-12-04  |  1.5 KB  |  45 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = 0   'False
  4. END
  5. Attribute VB_Name = "WorkerProvider"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Attribute VB_Description = "Singleuse server to host remote AEWorker.Worker objects."
  11. Option Explicit
  12.  
  13. Private moInitialErr As ErrObject    'Error that occurred during Class_Initialize
  14.  
  15. Public Function GetWorker() As AEWorker.Worker
  16. Attribute GetWorker.VB_Description = "Returns a new AEWorker.Worker instance."
  17.     'Raise error if error occured during Class_Initialize
  18.     If Not moInitialErr Is Nothing Then
  19.         Err.Raise Err.Number, , Err.Description
  20.     End If
  21.     
  22.     Set GetWorker = New AEWorker.Worker
  23.     
  24. End Function
  25.  
  26. Private Sub Class_Initialize()
  27.     'Make sure the AEWorker.Worker Class is registered
  28.     'local because AEClient may have run on machine
  29.     'previously.  It could leave AEWorker.Worker registered
  30.     'remote if it did not unload properly.
  31.     Dim oRacReg As RacReg.RegClass
  32.     Dim iResult As Integer          'Error return code
  33.     On Error GoTo Class_InitializeError
  34.     
  35.     Set oRacReg = New RacReg.RegClass
  36.     iResult = oRacReg.SetAutoServerSettings(False, "AEWorker.Worker")
  37.     If iResult > 0 Then
  38.         'Error occurred in RacReg
  39.         Err.Raise giRACREG_ERROR + vbObjectError, , ReplaceString(LoadResString(giRACREG_ERROR), gsNAME_TOKEN, LoadResString(iResult + giRACREG_ERROR_CODE_OFFSET))
  40.     End If
  41.     Exit Sub
  42. Class_InitializeError:
  43.     Set moInitialErr = Err
  44. End Sub
  45.